package shootingtactics.client.top;

import shootingtactics.client.BaseComposite;
import shootingtactics.client.game.GameTop;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.ui.Widget;

public class Index extends BaseComposite {

    private static IndexUiBinder uiBinder = GWT.create(IndexUiBinder.class);

    interface IndexUiBinder extends UiBinder<Widget, Index> {
    }

    @UiField
    MenuItem topMenu;

    @UiField
    MenuItem editBossMenu;

    @UiField
    MenuItem contact;

    @UiField
    MenuItem about;

    @UiField
    FlowPanel mainPanel;

    public Index() {
        initWidget(uiBinder.createAndBindUi(this));
        setMenuEvent();
        setTop();
    }

    private void setMenuEvent(){
        topMenu.setCommand(new Command(){

            public void execute(){
                setRemove();
                setTop();
            }
        });

        editBossMenu.setCommand(new Command(){

            public void execute(){
                setRemove();
                setCreatePlaylist();
            }
        });

        contact.setCommand(new Command(){

            public void execute(){
                setRemove();
                setContact();

            }
        });

        about.setCommand(new Command(){

            public void execute(){
                setRemove();
                setAbout();
            }
        });
    }

    protected void setAbout() {
        // TODO 自動生成されたメソッド・スタブ

    }

    protected void setContact() {
        // TODO 自動生成されたメソッド・スタブ

    }

    protected void setCreatePlaylist() {
        //mainPanel.add(new CreatePlaylist());
    }

    protected void setTop() {
        mainPanel.add(new GameTop());

    }

    protected void setRemove() {
        mainPanel.clear();
    }
}
